package com.example.listviewtest;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {
    private ListView lv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        lv=findViewById(R.id.lv);
        List<HeroAdapter.BaseItem> list=new ArrayList<>();
        list.add(new HeroAdapter.TextItem(HeroAdapter.BaseItem.TEXT,"法师"));
        list.add(new HeroAdapter.HeroItem(HeroAdapter.BaseItem.HERO,"妲己","女","来和妲己玩耍吧！"));
        list.add(new HeroAdapter.TextItem(HeroAdapter.BaseItem.TEXT,"射手"));
        list.add(new HeroAdapter.HeroItem(HeroAdapter.BaseItem.HERO,"后羿","男","发光的一个就够了。"));
        list.add(new HeroAdapter.HeroItem(HeroAdapter.BaseItem.HERO,"卤蛋","男","有人需要提供技术支持吗？"));
        list.add(new HeroAdapter.TextItem(HeroAdapter.BaseItem.TEXT,"打野"));
        list.add(new HeroAdapter.HeroItem(HeroAdapter.BaseItem.HERO,"猴子","男","超出三界之外，不在五行之中。"));
        list.add(new HeroAdapter.HeroItem(HeroAdapter.BaseItem.HERO,"李白","男","将进酒，杯莫停。"));
        list.add(new HeroAdapter.HeroItem(HeroAdapter.BaseItem.HERO,"典韦","男","疯狂的是我，还是整个世界！"));
        HeroAdapter heroAdapter = new HeroAdapter(list);
        lv.setAdapter(heroAdapter);
    }
}